import { defineStore } from 'pinia';
import { ref,reactive } from 'vue';
//
export const piniastore = defineStore('piniastore',()=>{
	let user = {};
	//存储数据时调用这个方法
	function saveUser(param){
		console.log("param===============",param);
		user = param;
	}
	//获取数据时调用这个方法
	function getUser(){
		return user;
	}
	/*
	main.js 也需要增加
	
	import { createSSRApp } from 'vue'
	import * as Pinia from 'pinia';
	export function createApp() {
	  const app = createSSRApp(App)
	  app.use(Pinia.createPinia());
	  return {
	    app,
	  	Pinia
	  }
	}
	
	
	
	使用举例
	
	存储
	import {piniastore} from "@/store/compinia";
	const ps = piniastore();
	ps.saveObj("王世明");
	
	获取
	import {piniastore} from "@/store/compinia";
	const ps = piniastore();
	console.log("ps.getObj()======",ps.getObj());
	
	
	*/
	
	return {saveUser,getUser }
});